function test() 
{
	_imageData = Filters.noise(_imageData, 'gaussian', 0, 0.1);
	Utilities.setImageToCanvas('canvasMain', _imageData, true);
}

function onNoise()
{
	var val = prompt("Please enter params: PDFName,Arg_1,Arg_2", "gaussian,0,0.3/impulse,0.1,0.9/rayleigh,0.01,0.02/erlang,10,1/uniform,0.1,0.2");
	if (val != null && val != "")
	{
		var params = Utilities.parseParams(val);
		if (params.length < 3)
			return;
		_imageData = Filters.noise(_imageData, params[0], parseFloat(params[1]), parseFloat(params[2]));
		Utilities.setImageToCanvas('canvasMain', _imageData, true);
	}
}

function onCanny()
{
	var val = prompt("Please enter params in range [0, 255]: LowThreshold,HighThreshold", "20,60");
	if (val != null && val != "")
	{
		var params = Utilities.parseParams(val);
		if (params.length < 2)
			return;
		_imageData = Filters.canny(_imageData, parseFloat(params[0]), parseInt(params[1]));
		Utilities.setImageToCanvas('canvasMain', _imageData, true);
	}	
}

function onBlur()
{
	var val = prompt("Please enter params: GaussianSigma,GaussianKernelSize", "1.4,5");
	if (val != null && val != "")
	{
		var params = Utilities.parseParams(val);
		if (params.length < 2)
			return;
		_imageData = Filters.blur(_imageData, parseFloat(params[0]), parseInt(params[1]));
		Utilities.setImageToCanvas('canvasMain', _imageData, true);
	}
}

function onLoG()
{
	var val = prompt("Please enter params: LoGSigma,LoGKernelSize", "1.4,9");
	if (val != null && val != "")
	{
		var params = Utilities.parseParams(val);
		if (params.length < 2)
			return;
		_imageData = Filters.loG(_imageData, parseFloat(params[0]), parseInt(params[1]));
		Utilities.setImageToCanvas('canvasMain', _imageData, true);
	}
}

function onMedian()
{
	var val = prompt("Please enter params: MedianKernelSize", "5");
	if (val != null && val != "")
	{
		var params = Utilities.parseParams(val);
		if (params.length < 1)
			return;
		_imageData = Filters.median(_imageData, parseInt(params[0]));
		Utilities.setImageToCanvas('canvasMain', _imageData, true);
	}
}


function onGrayscale()
{
	_imageData = Filters.grayscale(_imageData);
	Utilities.setImageToCanvas('canvasMain', _imageData, true);
}

function onInvert()
{
	_imageData = Filters.invert(_imageData);
	Utilities.setImageToCanvas('canvasMain', _imageData, true);
}

function onBrighten()
{
	var val = prompt("Please enter params: BrightenValue", "10");
	if (val != null && val != "")
	{
		var params = Utilities.parseParams(val);
		if (params.length < 1)
			return;
		_imageData = Filters.brightness(_imageData, parseInt(params[0]));
		Utilities.setImageToCanvas('canvasMain', _imageData, true);
	}
}

function onEqualizeHistogram()
{
	_imageData = Filters.grayscale(_imageData);
	_imageData = Filters.equalizeHistogram(_imageData);
	
	Utilities.setImageToCanvas('canvasMain', _imageData, true);
}
